import BaiduMap from "@/views/homePage/baiduMap.vue";

import axios from "axios";

import Vue from "vue";


export default {
    // url: require('@/assets/img/image2.png'),
    data: Vue.observable({
        url: require('@/assets/img/image2.png'),
    }),
    // 摄像头ip地址
    cameraIp: "192.168.1.40:8082",
    colorsChart: ['#e062ae', '#fb7293', '#e690d1', '#32c5e9', '#96bfff'],
    ws: null,


    components: { // 引入组件
        BaiduMap
    },
    methods: {
        getIp(ip) {
            console.log("摄像头" + ip);
            // /cameras/{id}
            this.cameraIp = ip;

            // 发送GET请求
            axios.get('http://192.168.1.46:8085/cameras/' + ip, {
                params: {
                    ip: ip
                }
            })
                .then(response => {
                    this.cameraIp = response.data;
                    console.log('获取摄像头信息成功', response.data.ip);
                    // 处理获取到的摄像头信息
                })
                .catch(error => {
                    console.error('获取摄像头信息失败', error);
                });
        }
    },
}
